home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 August: Tool Chest / Dev.CD Aug 95 TC / Dev.CD Aug 95 TC.toast / Tool Chest / Interfaces / UniversalInterfaces 2.1B1 / AIncludes / OSA.a < prev    next >
Encoding:
Text File  |  1995-04-18  |  54.3 KB  |  1,806 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        OSA.a
  3. ;
  4. ;    Contains:    AppleScript Client Interfaces.
  5. ;
  6. ;    Version:    Technology:    AppleScript 1.1
  7. ;                Package:    Universal Interfaces 2.1ß1 in “MPW Prerelease” on ETO #17
  8. ;
  9. ;    Copyright:    © 1984-1995 by Apple Computer, Inc.
  10. ;                All rights reserved.
  11. ;
  12. ;    Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13. ;                stack.  Include the file and version information (from above)
  14. ;                in the problem description and send to:
  15. ;                    Internet:    apple.bugs@applelink.apple.com
  16. ;                    AppleLink:    APPLE.BUGS
  17. ;
  18. ;
  19.  
  20.     IF &TYPE('__OSA__') = 'UNDEFINED' THEN
  21. __OSA__ SET 1
  22.  
  23.  
  24.     IF &TYPE('__ERRORS__') = 'UNDEFINED' THEN
  25.     include 'Errors.a'
  26.     ENDIF
  27. ;        include 'ConditionalMacros.a'                                ;
  28.  
  29.     IF &TYPE('__APPLEEVENTS__') = 'UNDEFINED' THEN
  30.     include 'AppleEvents.a'
  31.     ENDIF
  32. ;        include 'Types.a'                                            ;
  33. ;        include 'Memory.a'                                            ;
  34. ;            include 'MixedMode.a'                                    ;
  35. ;        include 'OSUtils.a'                                        ;
  36. ;        include 'Events.a'                                            ;
  37. ;            include 'Quickdraw.a'                                    ;
  38. ;                include 'QuickdrawText.a'                            ;
  39. ;        include 'EPPC.a'                                            ;
  40. ;            include 'AppleTalk.a'                                    ;
  41. ;            include 'Files.a'                                        ;
  42. ;            include 'PPCToolbox.a'                                    ;
  43. ;            include 'Processes.a'                                    ;
  44. ;        include 'Notification.a'                                    ;
  45.  
  46.     IF &TYPE('__AEOBJECTS__') = 'UNDEFINED' THEN
  47.     include 'AEObjects.a'
  48.     ENDIF
  49.  
  50.     IF &TYPE('__COMPONENTS__') = 'UNDEFINED' THEN
  51.     include 'Components.a'
  52.     ENDIF
  53.  
  54. kOSAComponentType                EQU        'osa '
  55.  
  56. ; 0x73637074 
  57. kOSAGenericScriptingComponentSubtype EQU        'scpt'
  58.  
  59. ;    Type of script document files.    
  60. ; 0x6f736173 
  61. kOSAFileType                    EQU        'osas'
  62.  
  63. ;
  64. ;        Suite and event code of the RecordedText event. 
  65. ;        (See OSAStartRecording, below.)
  66. ;    
  67. ; 0x61736372 
  68. kOSASuite                        EQU        'ascr'
  69.  
  70. ; 0x72656364 
  71. kOSARecordedText                EQU        'recd'
  72.  
  73. ; Selector returns boolean 
  74. ; 0x6d6f6469 
  75. kOSAScriptIsModified            EQU        'modi'
  76.  
  77. ; Selector returns boolean 
  78. ; 0x63736372 
  79. kOSAScriptIsTypeCompiledScript    EQU        'cscr'
  80.  
  81. ; Selector returns boolean 
  82. ; 0x76616c75 
  83. kOSAScriptIsTypeScriptValue        EQU        'valu'
  84.  
  85. ; Selector returns boolean 
  86. ; 0x636e7478 
  87. kOSAScriptIsTypeScriptContext    EQU        'cntx'
  88.  
  89. ; Selector returns a DescType which may be passed to OSACoerceToDesc 
  90. ; 0x62657374 
  91. kOSAScriptBestType                EQU        'best'
  92.  
  93. ;
  94. ;        This selector is used to determine whether a script has source 
  95. ;        associated with it that when given to OSAGetSource, the call will not
  96. ;        fail.  The selector returns a boolean.
  97. ;    
  98. ; 0x67737263 
  99. kOSACanGetSource                EQU        'gsrc'
  100.  
  101. typeOSADialectInfo                EQU        'difo'                ;  0x6469666f   
  102. keyOSADialectName                EQU        'dnam'                ;  0x646e616d   
  103. keyOSADialectCode                EQU        'dcod'                ;  0x64636f64   
  104. keyOSADialectLangCode            EQU        'dlcd'                ;  0x646c6364   
  105. keyOSADialectScriptCode            EQU        'dscd'
  106.  
  107. ; typedef ComponentResult     OSAError
  108. ; Under the Open Scripting Architecture all error results are longs 
  109. ; typedef unsigned long     OSAID
  110. ;
  111. ;        OSAIDs allow transparent manipulation of scripts associated with
  112. ;         various scripting systems.
  113. ;    
  114.  
  115. kOSANullScript                    EQU        0
  116.  
  117. ; No -script constant. 
  118. kOSANullMode                    EQU        0                    ; sounds better 
  119. kOSAModeNull                    EQU        0                    ; tastes consistent 
  120.  
  121. ;
  122. ;        Some routines take flags that control their execution.  This constant
  123. ;        declares default mode settings are used.
  124. ;    
  125. ;*************************************************************************
  126. ;    Standard Script Errors
  127. ;**************************************************************************
  128. ;    It is recommended that scripting components use the following set of error
  129. ;    codes to signal failure when applicable.  This enables applications that
  130. ;    use the OSA API to deal with some class of script errors in a less than 
  131. ;    ad hoc manner.  Scripting components are of course encouraged to return
  132. ;    component-specific errors when these don't apply.
  133. ;*************************************************************************
  134. ;        Dynamic errors:
  135. ;
  136. ;    These errors result from data-dependent conditions and are typically
  137. ;    signaled at runtime.
  138. ;
  139. ;
  140. ;        Signaled when a value can't be coerced to the desired type. Similar
  141. ;          to errOSATypeError except results from coercion.
  142. ;    
  143. errOSACantCoerce                EQU        errAECoercionFail
  144.  
  145. ; Signaled when an object is not found in a container 
  146. errOSACantAccess                EQU        errAENoSuchObject
  147.  
  148. ;
  149. ;        Signaled when an object cannot be set in a container.  Same as 
  150. ;          AERegistry error errAEWriteDenied.
  151. ;    
  152. errOSACantAssign                EQU        -10006
  153.  
  154. ;
  155. ;        Signaled by user scripts or applications when no actual error code
  156. ;          is to be returned.  Simply means "an error has occurred".  Most useful
  157. ;          in conjunction with an error message from the application.
  158. ;    
  159. errOSAGeneralError                EQU        -2700
  160.  
  161. ; Signaled when there is an attempt to divide by zero 
  162. errOSADivideByZero                EQU        -2701
  163.  
  164. ; Signaled when integer or real value is too large to be represented 
  165. errOSANumericOverflow            EQU        -2702
  166.  
  167. ;
  168. ;        Signaled when application can't be launched or when it is remote and
  169. ;          program linking is not enabled.
  170. ;    
  171. errOSACantLaunch                EQU        -2703
  172.  
  173. ; Signaled when an application can't respond to AppleEvents 
  174. errOSAAppNotHighLevelEventAware    EQU        -2704
  175.  
  176. ; Signaled when an application's terminology resource is not readable 
  177. errOSACorruptTerminology        EQU        -2705
  178.  
  179. ; Signaled when the runtime stack overflows 
  180. errOSAStackOverflow                EQU        -2706
  181.  
  182. ; Signaled when a runtime internal data structure overflows 
  183. errOSAInternalTableOverflow        EQU        -2707
  184.  
  185. ;
  186. ;        Signaled when an intrinsic limitation is exceeded for the size of 
  187. ;          a value or data structure.
  188. ;    
  189. errOSADataBlockTooLarge            EQU        -2708
  190.  
  191. errOSACantGetTerminology        EQU        -2709
  192.  
  193. errOSACantCreate                EQU        -2710
  194.  
  195. ;        Component-specific dynamic script errors:
  196. ;
  197. ;    The range -2720 thru -2739 is reserved for component-specific runtime errors.
  198. ;    (Note that error codes from different scripting components in this range will
  199. ;    overlap.)
  200. ;
  201. ;        Static errors:
  202. ;
  203. ;    These errors comprise what are commonly thought of as parse and compile-
  204. ;    time errors.  However, in a dynamic system (e.g. AppleScript) any or all
  205. ;    of these may also occur at runtime.
  206. ;
  207. ; Signaled when data was not the right type and coercion is not allowed 
  208. errOSATypeError                    EQU        errAEWrongDataType
  209.  
  210. ; Signaled when a message was sent to an object that didn't handle it 
  211. OSAMessageNotUnderstood            EQU        errAEEventNotHandled
  212.  
  213. ;
  214. ;        Signaled when a function to be returned doesn't exist.  (Probably only
  215. ;          useful in languages with first-class functions that distinguish between
  216. ;          functions and other values (two name spaces). This is different from
  217. ;          errOSAMessageNotUnderstood, which may be signaled when the method is
  218. ;          invoked.
  219. ;    
  220. OSAUndefinedHandler                EQU        errAEHandlerNotFound
  221.  
  222. ; Signaled when a container can never have the requested object 
  223. OSAIllegalAccess                EQU        errAEAccessorNotFound
  224.  
  225. ; Signaled when index was out of range. Specialization of errOSACantAccess. 
  226. OSAIllegalIndex                    EQU        errAEIllegalIndex
  227.  
  228. ; Signaled when a range is screwy. Specialization of errOSACantAccess. 
  229. OSAIllegalRange                    EQU        errAEImpossibleRange
  230.  
  231. ;
  232. ;        Signaled when an object can never be set in a container.  Same as 
  233. ;          AERegistry error errAENotModifiable.
  234. ;    
  235. OSAIllegalAssign                EQU        -10003
  236.  
  237. ;
  238. ;        Signaled when a syntax error occurs. (e.g. "Syntax error" or
  239. ;         "<this> can't go after <that>").
  240. ;    
  241. OSASyntaxError                    EQU        -2740
  242.  
  243. ;
  244. ;        Signaled when another form of syntax was expected. (e.g. "expected
  245. ;          a <type> but found <this>").
  246. ;    
  247. OSASyntaxTypeError                EQU        -2741
  248.  
  249. ; Signaled when a name or number is too long to be parsed 
  250. OSATokenTooLong                    EQU        -2742
  251.  
  252. ;
  253. ;        Signaled when a parameter is missing for a function invocation.  Note
  254. ;          that in some languages, this error may occur at runtime.
  255. ;    
  256. OSAMissingParameter                EQU        errAEDescNotFound
  257.  
  258. ;
  259. ;        Signaled when function is called with the wrong number of parameters,
  260. ;          or a parameter pattern cannot be matched.
  261. ;    
  262. OSAParameterMismatch            EQU        errAEWrongNumberArgs
  263.  
  264. ;
  265. ;        Signaled when a formal parameter, local variable, or instance variable
  266. ;          is specified more than once.
  267. ;    
  268. OSADuplicateParameter            EQU        -2750
  269.  
  270. ;
  271. ;        Signaled when a formal parameter, local variable, or instance variable
  272. ;          is specified more than once.
  273. ;    
  274. OSADuplicateProperty            EQU        -2751
  275.  
  276. ;
  277. ;        Signaled when more than one handler is defined with the same name in 
  278. ;          a scope where the language doesn't allow it.
  279. ;    
  280. OSADuplicateHandler                EQU        -2752
  281.  
  282. ; Signaled when a variable is accessed that has no value 
  283. OSAUndefinedVariable            EQU        -2753
  284.  
  285. ;
  286. ;        Signaled when a variable is declared inconsistently in the same scope,
  287. ;          such as both local and global.
  288. ;    
  289. OSAInconsistentDeclarations        EQU        -2754
  290.  
  291. ;
  292. ;        Signaled when illegal control flow occurs in an application (no catcher
  293. ;          for throw, non-lexical loop exit, etc.).
  294. ;    
  295. OSAControlFlowError                EQU        -2755
  296.  
  297. ;        Component-specific static script errors:
  298. ;
  299. ;    The range -2760 thru -2779 is reserved for component-specific parsing and
  300. ;    compile-time errors. (Note that error codes from different scripting
  301. ;    components in this range will overlap.)
  302. ;
  303. ;        Dialect-specific script errors:
  304. ;
  305. ;    The range -2780 thru -2799 is reserved for dialect specific error codes for
  306. ;    scripting components that support dialects. (Note that error codes from
  307. ;    different scripting components in this range will overlap, as well as error
  308. ;    codes from different dialects in the same scripting component.)
  309. ;
  310. ;*************************************************************************
  311. ;    OSA Interface Descriptions
  312. ;**************************************************************************
  313. ;    The OSA Interface is broken down into a required interface, and several
  314. ;    optional interfaces to support additional functionality.  A given scripting
  315. ;    component may choose to support only some of the optional interfaces in
  316. ;    addition to the basic interface.  The OSA Component Flags may be used to 
  317. ;    query the Component Manager to find a scripting component with a particular
  318. ;    capability, or determine if a particular scripting component supports a 
  319. ;    particular capability.
  320. ;*************************************************************************
  321. ; OSA Component Flags: 
  322. kOSASupportsCompiling            EQU        $0002
  323. kOSASupportsGetSource            EQU        $0004
  324. kOSASupportsAECoercion            EQU        $0008
  325. kOSASupportsAESending            EQU        $0010
  326. kOSASupportsRecording            EQU        $0020
  327. kOSASupportsConvenience            EQU        $0040
  328. kOSASupportsDialects            EQU        $0080
  329. kOSASupportsEventHandling        EQU        $0100
  330.  
  331. ; Component Selectors: 
  332. kOSASelectLoad                    EQU        $0001
  333. kOSASelectStore                    EQU        $0002
  334. kOSASelectExecute                EQU        $0003
  335. kOSASelectDisplay                EQU        $0004
  336. kOSASelectScriptError            EQU        $0005
  337. kOSASelectDispose                EQU        $0006
  338. kOSASelectSetScriptInfo            EQU        $0007
  339. kOSASelectGetScriptInfo            EQU        $0008
  340. kOSASelectSetActiveProc            EQU        $0009
  341. kOSASelectGetActiveProc            EQU        $000A
  342.  
  343. ; Compiling: 
  344. kOSASelectScriptingComponentName EQU        $0102
  345. kOSASelectCompile                EQU        $0103
  346. kOSASelectCopyID                EQU        $0104
  347.  
  348. ; GetSource: 
  349. kOSASelectGetSource                EQU        $0201
  350.  
  351. ; AECoercion: 
  352. kOSASelectCoerceFromDesc        EQU        $0301
  353. kOSASelectCoerceToDesc            EQU        $0302
  354.  
  355. ; AESending: 
  356. kOSASelectSetSendProc            EQU        $0401
  357. kOSASelectGetSendProc            EQU        $0402
  358. kOSASelectSetCreateProc            EQU        $0403
  359. kOSASelectGetCreateProc            EQU        $0404
  360. kOSASelectSetDefaultTarget        EQU        $0405
  361.  
  362. ; Recording: 
  363. kOSASelectStartRecording        EQU        $0501
  364. kOSASelectStopRecording            EQU        $0502
  365.  
  366. ; Convenience: 
  367. kOSASelectLoadExecute            EQU        $0601
  368. kOSASelectCompileExecute        EQU        $0602
  369. kOSASelectDoScript                EQU        $0603
  370.  
  371. ; Dialects: 
  372. kOSASelectSetCurrentDialect        EQU        $0701
  373. kOSASelectGetCurrentDialect        EQU        $0702
  374. kOSASelectAvailableDialects        EQU        $0703
  375. kOSASelectGetDialectInfo        EQU        $0704
  376. kOSASelectAvailableDialectCodeList EQU        $0705
  377.  
  378. ; Event Handling: 
  379. kOSASelectSetResumeDispatchProc    EQU        $0801
  380. kOSASelectGetResumeDispatchProc    EQU        $0802
  381. kOSASelectExecuteEvent            EQU        $0803
  382. kOSASelectDoEvent                EQU        $0804
  383. kOSASelectMakeContext            EQU        $0805
  384.  
  385. ; scripting component specific selectors are added beginning with this value  
  386. kOSASelectComponentSpecificStart EQU        $1001
  387.  
  388. ;        Mode Flags:
  389. ;
  390. ;    Warning: These should not conflict with the AESend mode flags in
  391. ;    AppleEvents.h, because we may want to use them as OSA mode flags too.
  392. ;
  393. ;
  394. ;        This mode flag may be passed to OSALoad, OSAStore or OSACompile to
  395. ;          instruct the scripting component to not retain the "source" of an
  396. ;          expression.  This will cause the OSAGetSource call to return the error
  397. ;          errOSASourceNotAvailable if used.  However, some scripting components
  398. ;          may not retain the source anyway.  This is mainly used when either space
  399. ;          efficiency is desired, or a script is to be "locked" so that its
  400. ;          implementation may not be viewed.
  401. ;    
  402. kOSAModePreventGetSource        EQU        $00000001
  403.  
  404. ;
  405. ;        These mode flags may be passed to OSACompile, OSAExecute, OSALoadExecute
  406. ;          OSACompileExecute, OSADoScript, OSAExecuteEvent, or OSADoEvent to
  407. ;          indicate whether or not the script may interact with the user, switch
  408. ;          layer or reconnect if necessary.  Any AppleEvents will be sent with the
  409. ;          corresponding AESend mode supplied.
  410. ;    
  411. kOSAModeNeverInteract            EQU        kAENeverInteract
  412. kOSAModeCanInteract                EQU        kAECanInteract
  413. kOSAModeAlwaysInteract            EQU        kAEAlwaysInteract
  414. kOSAModeDontReconnect            EQU        kAEDontReconnect
  415.  
  416. ;
  417. ;        This mode flag may be passed to OSACompile, OSAExecute, OSALoadExecute
  418. ;          OSACompileExecute, OSADoScript, OSAExecuteEvent, or OSADoEvent to
  419. ;          indicate whether or not AppleEvents should be sent with the
  420. ;          kAECanSwitchLayer mode flag sent or not. NOTE: This flag is exactly the
  421. ;          opposite sense of the AppleEvent flag kAECanSwitchLayer.  This is to
  422. ;          provide a more convenient default, i.e. not supplying any mode
  423. ;          (kOSAModeNull) means to send events with kAECanSwitchLayer.  Supplying
  424. ;          the kOSAModeCantSwitchLayer mode flag will cause AESend to be called
  425. ;          without kAECanSwitchLayer.
  426. ;    
  427. kOSAModeCantSwitchLayer            EQU        $00000040
  428.  
  429. ;
  430. ;        This mode flag may be passed to OSACompile, OSAExecute, OSALoadExecute
  431. ;          OSACompileExecute, OSADoScript, OSAExecuteEvent, or OSADoEvent to
  432. ;          indicate whether or not AppleEvents should be sent with the kAEDontRecord
  433. ;          mode flag sent or not. NOTE: This flag is exactly the opposite sense of
  434. ;          the AppleEvent flag kAEDontRecord.  This is to provide a more convenient
  435. ;          default, i.e. not supplying any mode (kOSAModeNull) means to send events
  436. ;          with kAEDontRecord.  Supplying the kOSAModeDoRecord mode flag will 
  437. ;          cause AESend to be called without kAEDontRecord.
  438. ;    
  439. kOSAModeDoRecord                EQU        $00001000
  440.  
  441. ;
  442. ;        This is a mode flag for OSACompile that indicates that a context should
  443. ;          be created as the result of compilation. All handler definitions are
  444. ;          inserted into the new context, and variables are initialized by
  445. ;          evaluating their initial values in a null context (i.e. they must be
  446. ;          constant expressions).
  447. ;    
  448. kOSAModeCompileIntoContext        EQU        $00000002
  449.  
  450. ;
  451. ;        This is a mode flag for OSACompile that indicates that the previous
  452. ;          script ID (input to OSACompile) should be augmented with any new
  453. ;          definitions in the sourceData rather than replaced with a new script.
  454. ;          This means that the previous script ID must designate a context.
  455. ;          The presence of this flag causes the kOSAModeCompileIntoContext flag
  456. ;          to be implicitly used, causing any new definitions to be initialized
  457. ;          in a null context.
  458. ;    
  459. kOSAModeAugmentContext            EQU        $00000004
  460.  
  461. ;
  462. ;        This mode flag may be passed to OSADisplay or OSADoScript to indicate
  463. ;          that output only need be human-readable, not re-compilable by OSACompile.
  464. ;          If used, output may be arbitrarily "beautified", e.g. quotes may be left
  465. ;          off of string values, long lists may have elipses, etc.
  466. ;    
  467. kOSAModeDisplayForHumans        EQU        $00000008
  468.  
  469. ;
  470. ;        This mode flag may be passed to OSAStore in the case where the scriptID
  471. ;          is a context.  This causes the context to be saved, but not the context's
  472. ;          parent context.  When the stored context is loaded back in, the parent
  473. ;          will be kOSANullScript.
  474. ;    
  475. kOSAModeDontStoreParent            EQU        $00010000
  476.  
  477. ;
  478. ;        This mode flag may be passed to OSAExecuteEvent to cause the event to
  479. ;          be dispatched to the direct object of the event. The direct object (or
  480. ;          subject attribute if the direct object is a non-object specifier) will
  481. ;          be resolved, and the resulting script object will be the recipient of
  482. ;          the message. The context argument to OSAExecuteEvent will serve as the
  483. ;          root of the lookup/resolution process.
  484. ;    
  485. kOSAModeDispatchToDirectObject    EQU        $00020000
  486.  
  487. ;
  488. ;        This mode flag may be passed to OSAExecuteEvent to indicate that
  489. ;          components do not have to get the data of object specifier arguments.
  490. ;    
  491. kOSAModeDontGetDataForArguments    EQU        $00040000
  492.  
  493. ;*************************************************************************
  494. ;    OSA Basic Scripting Interface
  495. ;**************************************************************************
  496. ;    Scripting components must at least support the Basic Scripting interface.
  497. ;*************************************************************************
  498. ;        Loading and Storing Scripts:
  499. ;
  500. ;    These routines allow scripts to be loaded and stored in their internal
  501. ;    (possibly compiled, non-text) representation.
  502. ;
  503. ; Resource type for scripts 
  504. kOSAScriptResourceType            EQU        kOSAGenericScriptingComponentSubtype
  505.  
  506. ;
  507. ;        Default type given to OSAStore which creates "generic" loadable script
  508. ;          data descriptors.
  509. ;    
  510. typeOSAGenericStorage            EQU        kOSAScriptResourceType
  511.  
  512. ;
  513. ; pascal OSAError OSALoad(ComponentInstance scriptingComponent, const AEDesc *scriptData, long modeFlags, OSAID *resultingScriptID)
  514. ;
  515.     IF ¬ GENERATINGCFM THEN
  516.         Macro
  517.         _OSALoad
  518.             dc.w     $2F3C
  519.             dc.w     $000C
  520.             dc.w     $0001
  521.             moveq    #0,d0
  522.             dc.w     $A82A
  523.         EndM
  524.     ELSE
  525.         IMPORT_CFM_FUNCTION    OSALoad
  526.     ENDIF
  527.  
  528. ;
  529. ;        OSAComponentFunctionInline(kOSASelectLoad, 12);
  530. ;    
  531. ;        Errors:
  532. ;            badComponentInstance        invalid scripting component instance
  533. ;            errOSASystemError
  534. ;            errOSABadStorageType:        scriptData not for this scripting component
  535. ;            errOSACorruptData:            data seems to be corrupt
  536. ;            errOSADataFormatObsolete    script data format is no longer supported
  537. ;            errOSADataFormatTooNew        script data format is from a newer version
  538. ;        
  539. ;        ModeFlags:
  540. ;            kOSAModePreventGetSource
  541. ;    
  542. ;
  543. ; pascal OSAError OSAStore(ComponentInstance scriptingComponent, OSAID scriptID, DescType desiredType, long modeFlags, AEDesc *resultingScriptData)
  544. ;
  545.     IF ¬ GENERATINGCFM THEN
  546.         Macro
  547.         _OSAStore
  548.             dc.w     $2F3C
  549.             dc.w     $0010
  550.             dc.w     $0002
  551.             moveq    #0,d0
  552.             dc.w     $A82A
  553.         EndM
  554.     ELSE
  555.         IMPORT_CFM_FUNCTION    OSAStore
  556.     ENDIF
  557.  
  558. ;
  559. ;        OSAComponentFunctionInline(kOSASelectStore, 16);
  560. ;    
  561. ;        Errors:
  562. ;            badComponentInstance    invalid scripting component instance
  563. ;            errOSASystemError
  564. ;            errOSAInvalidID
  565. ;            errOSABadStorageType:    desiredType not for this scripting component
  566. ;        
  567. ;        ModeFlags:
  568. ;            kOSAModePreventGetSource
  569. ;            kOSAModeDontStoreParent
  570. ;    
  571. ; Executing Scripts: 
  572. ;
  573. ; pascal OSAError OSAExecute(ComponentInstance scriptingComponent, OSAID compiledScriptID, OSAID contextID, long modeFlags, OSAID *resultingScriptValueID)
  574. ;
  575.     IF ¬ GENERATINGCFM THEN
  576.         Macro
  577.         _OSAExecute
  578.             dc.w     $2F3C
  579.             dc.w     $0010
  580.             dc.w     $0003
  581.             moveq    #0,d0
  582.             dc.w     $A82A
  583.         EndM
  584.     ELSE
  585.         IMPORT_CFM_FUNCTION    OSAExecute
  586.     ENDIF
  587.  
  588. ;
  589. ;        OSAComponentFunctionInline(kOSASelectExecute, 16);
  590. ;        This call runs a script.  The contextID represents the environment
  591. ;        with which global variables in the script are resolved.  The constant
  592. ;        kOSANullScript may be used for the contextID if the application wishes
  593. ;        to not deal with context directly (a default one is associated with each
  594. ;        scripting component instance).  The resultingScriptValueID is the 
  595. ;        result of evaluation, and contains a value which may be displayed using
  596. ;        the OSAGetSource call.  The modeFlags convey scripting component
  597. ;        specific information.
  598. ;    
  599. ;        Errors:
  600. ;            badComponentInstance    invalid scripting component instance
  601. ;            errOSASystemError
  602. ;            errOSAInvalidID
  603. ;            errOSAScriptError:        the executing script got an error
  604. ;    
  605. ;        ModeFlags:
  606. ;            kOSAModeNeverInteract
  607. ;            kOSAModeCanInteract
  608. ;            kOSAModeAlwaysInteract
  609. ;            kOSAModeCantSwitchLayer
  610. ;            kOSAModeDontReconnect
  611. ;            kOSAModeDoRecord
  612. ;    
  613. ; Displaying results: 
  614. ;
  615. ; pascal OSAError OSADisplay(ComponentInstance scriptingComponent, OSAID scriptValueID, DescType desiredType, long modeFlags, AEDesc *resultingText)
  616. ;
  617.     IF ¬ GENERATINGCFM THEN
  618.         Macro
  619.         _OSADisplay
  620.             dc.w     $2F3C
  621.             dc.w     $0010
  622.             dc.w     $0004
  623.             moveq    #0,d0
  624.             dc.w     $A82A
  625.         EndM
  626.     ELSE
  627.         IMPORT_CFM_FUNCTION    OSADisplay
  628.     ENDIF
  629.  
  630. ;
  631. ;        OSAComponentFunctionInline(kOSASelectDisplay, 16);
  632. ;        This call is used to convert results (script value IDs) into displayable
  633. ;        text. The desiredType should be at least typeChar, and modeFlags are
  634. ;        scripting system specific flags to control the formatting of the
  635. ;        resulting text. This call differs from OSAGetSource in that (1) it
  636. ;        always produces at least typeChar, (2) is only works on script values,
  637. ;        (3) it may display it's output in non-compilable form (e.g. without
  638. ;        string quotes, elipses inserted in long and/or circular lists, etc.) and
  639. ;        (4) it is required by the basic scripting interface.
  640. ;    
  641. ;        Errors:
  642. ;            badComponentInstance    invalid scripting component instance
  643. ;            errOSASystemError
  644. ;            errOSAInvalidID
  645. ;            errAECoercionFail:        desiredType not supported by scripting component
  646. ;    
  647. ;        ModeFlags:
  648. ;            kOSAModeDisplayForHumans
  649. ;    
  650. ; Getting Error Information: 
  651. ;
  652. ; pascal OSAError OSAScriptError(ComponentInstance scriptingComponent, OSType selector, DescType desiredType, AEDesc *resultingErrorDescription)
  653. ;
  654.     IF ¬ GENERATINGCFM THEN
  655.         Macro
  656.         _OSAScriptError
  657.             dc.w     $2F3C
  658.             dc.w     $000C
  659.             dc.w     $0005
  660.             moveq    #0,d0
  661.             dc.w     $A82A
  662.         EndM
  663.     ELSE
  664.         IMPORT_CFM_FUNCTION    OSAScriptError
  665.     ENDIF
  666.  
  667. ;
  668. ;        OSAComponentFunctionInline(kOSASelectScriptError, 12);
  669. ;        Whenever script execution returns errOSAExecutionError, this routine
  670. ;        may be used to get information about that error.  The selector describes
  671. ;        the type of information desired about the error (various selectors are
  672. ;        listed below).  The desiredType indicates the data type of the result
  673. ;        desired for that selector.
  674. ;    
  675. ;        Errors:
  676. ;            badComponentInstance    invalid scripting component instance
  677. ;            errOSASystemError
  678. ;            errOSABadSelector:        selector not supported by scripting component
  679. ;            errAECoercionFail:        desiredType not supported by scripting component
  680. ;    
  681. ; OSAScriptError selectors: 
  682. ;
  683. ;        This selector is used to determine the error number of a script error.
  684. ;        These error numbers may be either system error numbers, or error numbers
  685. ;        that are scripting component specific.
  686. ;        Required desiredTypes:    
  687. ;              typeShortInteger
  688. ;    
  689. kOSAErrorNumber                    EQU        keyErrorNumber
  690.  
  691. ;
  692. ;        This selector is used to determine the full error message associated
  693. ;        with the error number.  It should include the name of the application
  694. ;        which caused the error, as well as the specific error that occurred.
  695. ;        This selector is sufficient for simple error reporting (but see
  696. ;        kOSAErrorBriefMessage, below).
  697. ;        Required desiredTypes:
  698. ;            typeChar                    error message string
  699. ;    
  700. kOSAErrorMessage                EQU        keyErrorString
  701.  
  702. ;
  703. ;        This selector is used to determine a brief error message associated with
  704. ;        the error number.  This message and should not mention the name of the
  705. ;        application which caused the error, any partial results or offending
  706. ;        object (see kOSAErrorApp, kOSAErrorPartialResult and
  707. ;        kOSAErrorOffendingObject, below).
  708. ;        Required desiredTypes:
  709. ;              typeChar                    brief error message string
  710. ;    
  711. ;  0x65727262  
  712. kOSAErrorBriefMessage            EQU        'errb'
  713.  
  714. ;
  715. ;        This selector is used to determine which application actually got the
  716. ;        error (if it was the result of an AESend), or the current application
  717. ;        if ....
  718. ;        Required desiredTypes:
  719. ;              typeProcessSerialNumber        PSN of the errant application
  720. ;              typeChar                    name of the errant application
  721. ;    
  722. ;  0x65726170  
  723. kOSAErrorApp                    EQU        'erap'
  724.  
  725. ;
  726. ;        This selector is used to determine any partial result returned by an 
  727. ;        operation. If an AESend call failed, but a partial result was returned,
  728. ;        then the partial result may be returned as an AEDesc.
  729. ;        Required desiredTypes:
  730. ;              typeBest                    AEDesc of any partial result
  731. ;    
  732. ;  0x70746c72   
  733. kOSAErrorPartialResult            EQU        'ptlr'
  734.  
  735. ;
  736. ;        This selector is used to determine any object which caused the error
  737. ;        that may have been indicated by an application.  The result is an 
  738. ;        AEDesc.
  739. ;        Required desiredTypes:
  740. ;              typeBest                    AEDesc of any offending object
  741. ;    
  742. ;  0x65726f62   
  743. kOSAErrorOffendingObject        EQU        'erob'
  744.  
  745. ;
  746. ;        This selector is used to determine the type expected by a coercion 
  747. ;        operation if a type error occurred.
  748. ;    
  749. ;  0x65727274   
  750. kOSAErrorExpectedType            EQU        'errt'
  751.  
  752. ;
  753. ;        This selector is used to determine the source text range (start and 
  754. ;        end positions) of where the error occurred.
  755. ;        Required desiredTypes:
  756. ;              typeOSAErrorRange
  757. ;    
  758. ;  0x65726e67  
  759. kOSAErrorRange                    EQU        'erng'
  760.  
  761. ;
  762. ;        An AERecord type containing keyOSASourceStart and keyOSASourceEnd fields
  763. ;        of type short.
  764. ;    
  765. ;  0x65726e67   
  766. typeOSAErrorRange                EQU        'erng'
  767.  
  768. ; Field of a typeOSAErrorRange record of typeShortInteger 
  769. ;  0x73726373    
  770. keyOSASourceStart                EQU        'srcs'
  771.  
  772. ; Field of a typeOSAErrorRange record of typeShortInteger 
  773. ;  0x73726365   
  774. keyOSASourceEnd                    EQU        'srce'
  775.  
  776. ; Disposing Script IDs: 
  777. ;
  778. ; pascal OSAError OSADispose(ComponentInstance scriptingComponent, OSAID scriptID)
  779. ;
  780.     IF ¬ GENERATINGCFM THEN
  781.         Macro
  782.         _OSADispose
  783.             dc.w     $2F3C
  784.             dc.w     $0004
  785.             dc.w     $0006
  786.             moveq    #0,d0
  787.             dc.w     $A82A
  788.         EndM
  789.     ELSE
  790.         IMPORT_CFM_FUNCTION    OSADispose
  791.     ENDIF
  792.  
  793. ;
  794. ;        OSAComponentFunctionInline(kOSASelectDispose, 4);
  795. ;        Disposes a script or context.
  796. ;    
  797. ;        Errors:
  798. ;            badComponentInstance    invalid scripting component instance
  799. ;            errOSASystemError
  800. ;            errOSAInvalidID
  801. ;    
  802. ; Getting and Setting Script Information: 
  803. ;
  804. ; pascal OSAError OSASetScriptInfo(ComponentInstance scriptingComponent, OSAID scriptID, OSType selector, long value)
  805. ;
  806.     IF ¬ GENERATINGCFM THEN
  807.         Macro
  808.         _OSASetScriptInfo
  809.             dc.w     $2F3C
  810.             dc.w     $000C
  811.             dc.w     $0007
  812.             moveq    #0,d0
  813.             dc.w     $A82A
  814.         EndM
  815.     ELSE
  816.         IMPORT_CFM_FUNCTION    OSASetScriptInfo
  817.     ENDIF
  818.  
  819. ;
  820. ;        OSAComponentFunctionInline(kOSASelectSetScriptInfo, 12);
  821. ;    
  822. ;        Errors:
  823. ;            badComponentInstance    invalid scripting component instance
  824. ;            errOSASystemError
  825. ;            errOSAInvalidID
  826. ;            errOSABadSelector:        selector not supported by scripting component
  827. ;                                    or selector not for this scriptID
  828. ;    
  829. ;
  830. ; pascal OSAError OSAGetScriptInfo(ComponentInstance scriptingComponent, OSAID scriptID, OSType selector, long *result)
  831. ;
  832.     IF ¬ GENERATINGCFM THEN
  833.         Macro
  834.         _OSAGetScriptInfo
  835.             dc.w     $2F3C
  836.             dc.w     $000C
  837.             dc.w     $0008
  838.             moveq    #0,d0
  839.             dc.w     $A82A
  840.         EndM
  841.     ELSE
  842.         IMPORT_CFM_FUNCTION    OSAGetScriptInfo
  843.     ENDIF
  844.  
  845. ;
  846. ;        OSAComponentFunctionInline(kOSASelectGetScriptInfo, 12);
  847. ;    
  848. ;        Errors:
  849. ;            badComponentInstance    invalid scripting component instance
  850. ;            errOSASystemError
  851. ;            errOSAInvalidID
  852. ;            errOSABadSelector:        selector not supported by scripting component
  853. ;                                    or selector not for this scriptID
  854. ;    
  855. ; Manipulating the ActiveProc:
  856. ;
  857. ;    Scripting systems will supply default values for these procedures if they
  858. ;    are not set by the client:
  859. ;
  860. ;
  861. ; pascal OSAError OSASetActiveProc(ComponentInstance scriptingComponent, OSAActiveUPP activeProc, long refCon)
  862. ;
  863.     IF ¬ GENERATINGCFM THEN
  864.         Macro
  865.         _OSASetActiveProc
  866.             dc.w     $2F3C
  867.             dc.w     $0008
  868.             dc.w     $0009
  869.             moveq    #0,d0
  870.             dc.w     $A82A
  871.         EndM
  872.     ELSE
  873.         IMPORT_CFM_FUNCTION    OSASetActiveProc
  874.     ENDIF
  875.  
  876. ;
  877. ;        OSAComponentFunctionInline(kOSASelectSetActiveProc, 8);
  878. ;        If activeProc is nil, the default activeProc is used.
  879. ;    
  880. ;        Errors:
  881. ;            badComponentInstance    invalid scripting component instance
  882. ;            errOSASystemError
  883. ;    
  884. ;
  885. ; pascal OSAError OSAGetActiveProc(ComponentInstance scriptingComponent, OSAActiveUPP *activeProc, long *refCon)
  886. ;
  887.     IF ¬ GENERATINGCFM THEN
  888.         Macro
  889.         _OSAGetActiveProc
  890.             dc.w     $2F3C
  891.             dc.w     $0008
  892.             dc.w     $000A
  893.             moveq    #0,d0
  894.             dc.w     $A82A
  895.         EndM
  896.     ELSE
  897.         IMPORT_CFM_FUNCTION    OSAGetActiveProc
  898.     ENDIF
  899.  
  900. ;
  901. ;        OSAComponentFunctionInline(kOSASelectGetActiveProc, 8);
  902. ;    
  903. ;        Errors:
  904. ;            badComponentInstance    invalid scripting component instance
  905. ;            errOSASystemError
  906. ;    
  907. ;*************************************************************************
  908. ;    OSA Optional Compiling Interface
  909. ;**************************************************************************
  910. ;    Scripting components that support the Compiling interface have the 
  911. ;    kOSASupportsCompiling bit set in it's ComponentDescription.
  912. ;*************************************************************************
  913. ;
  914. ; pascal OSAError OSAScriptingComponentName(ComponentInstance scriptingComponent, AEDesc *resultingScriptingComponentName)
  915. ;
  916.     IF ¬ GENERATINGCFM THEN
  917.         Macro
  918.         _OSAScriptingComponentName
  919.             dc.w     $2F3C
  920.             dc.w     $0004
  921.             dc.w     $0102
  922.             moveq    #0,d0
  923.             dc.w     $A82A
  924.         EndM
  925.     ELSE
  926.         IMPORT_CFM_FUNCTION    OSAScriptingComponentName
  927.     ENDIF
  928.  
  929. ;
  930. ;        OSAComponentFunctionInline(kOSASelectScriptingComponentName, 4);
  931. ;        Given a scripting component, this routine returns the name of that
  932. ;        scripting component in a type that is coercable to text (typeChar).
  933. ;        The generic scripting component returns the name of the default
  934. ;        scripting component.  This name should be sufficient to convey to the
  935. ;        user the kind of script (syntax) he is expected to write.
  936. ;    
  937. ;        Errors:
  938. ;            badComponentInstance    invalid scripting component instance
  939. ;            errOSASystemError
  940. ;    
  941. ;
  942. ; pascal OSAError OSACompile(ComponentInstance scriptingComponent, const AEDesc *sourceData, long modeFlags, OSAID *previousAndResultingScriptID)
  943. ;
  944.     IF ¬ GENERATINGCFM THEN
  945.         Macro
  946.         _OSACompile
  947.             dc.w     $2F3C
  948.             dc.w     $000C
  949.             dc.w     $0103
  950.             moveq    #0,d0
  951.             dc.w     $A82A
  952.         EndM
  953.     ELSE
  954.         IMPORT_CFM_FUNCTION    OSACompile
  955.     ENDIF
  956.  
  957. ;
  958. ;        OSAComponentFunctionInline(kOSASelectCompile, 12);
  959. ;        Coerces input desc (possibly text) into a script's internal format.
  960. ;        Once compiled, the script is ready to run.  The modeFlags convey
  961. ;        scripting component specific information.  The previous script ID
  962. ;        (result parameter) is made to refer to the newly compiled script,
  963. ;        unless it was originally kOSANullScript.  In this case a new script
  964. ;        ID is created and used.
  965. ;    
  966. ;        Errors:
  967. ;            badComponentInstance    invalid scripting component instance
  968. ;            errOSASystemError
  969. ;            errAECoercionFail:        sourceData is not compilable
  970. ;            errOSAScriptError:        sourceData was a bad script (syntax error)
  971. ;            errOSAInvalidID:        previousAndResultingCompiledScriptID was not
  972. ;                                    valid on input
  973. ;    
  974. ;        ModeFlags:
  975. ;            kOSAModePreventGetSource
  976. ;            kOSAModeCompileIntoContext
  977. ;            kOSAModeAugmentContext
  978. ;            kOSAModeNeverInteract
  979. ;            kOSAModeCanInteract
  980. ;            kOSAModeAlwaysInteract
  981. ;            kOSAModeCantSwitchLayer
  982. ;            kOSAModeDontReconnect
  983. ;            kOSAModeDoRecord
  984. ;    
  985. ;
  986. ; pascal OSAError OSACopyID(ComponentInstance scriptingComponent, OSAID fromID, OSAID *toID)
  987. ;
  988.     IF ¬ GENERATINGCFM THEN
  989.         Macro
  990.         _OSACopyID
  991.             dc.w     $2F3C
  992.             dc.w     $0008
  993.             dc.w     $0104
  994.             moveq    #0,d0
  995.             dc.w     $A82A
  996.         EndM
  997.     ELSE
  998.         IMPORT_CFM_FUNCTION    OSACopyID
  999.     ENDIF
  1000.  
  1001. ;
  1002. ;        OSAComponentFunctionInline(kOSASelectCopyID, 8);
  1003. ;        If toID is a reference to kOSANullScript then it is updated to have a
  1004. ;        new scriptID value.  This call can be used to perform undo or revert
  1005. ;        operations on scripts. 
  1006. ;    
  1007. ;        Errors:
  1008. ;            badComponentInstance    invalid scripting component instance
  1009. ;            errOSASystemError
  1010. ;            errOSAInvalidID
  1011. ;    
  1012. ;*************************************************************************
  1013. ;    OSA Optional GetSource Interface
  1014. ;**************************************************************************
  1015. ;    Scripting components that support the GetSource interface have the 
  1016. ;    kOSASupportsGetSource bit set in it's ComponentDescription.
  1017. ;*************************************************************************
  1018. ;
  1019. ; pascal OSAError OSAGetSource(ComponentInstance scriptingComponent, OSAID scriptID, DescType desiredType, AEDesc *resultingSourceData)
  1020. ;
  1021.     IF ¬ GENERATINGCFM THEN
  1022.         Macro
  1023.         _OSAGetSource
  1024.             dc.w     $2F3C
  1025.             dc.w     $000C
  1026.             dc.w     $0201
  1027.             moveq    #0,d0
  1028.             dc.w     $A82A
  1029.         EndM
  1030.     ELSE
  1031.         IMPORT_CFM_FUNCTION    OSAGetSource
  1032.     ENDIF
  1033.  
  1034. ;
  1035. ;        OSAComponentFunctionInline(kOSASelectGetSource, 12);
  1036. ;        This routine causes a compiled script to be output in a form (possibly
  1037. ;        text) such that it is suitable to be passed back to OSACompile.
  1038. ;
  1039. ;        Errors:
  1040. ;            badComponentInstance    invalid scripting component instance
  1041. ;            errOSASystemError
  1042. ;            errOSAInvalidID
  1043. ;            errOSASourceNotAvailable    can't get source for this scriptID
  1044. ;    
  1045. ;*************************************************************************
  1046. ;    OSA Optional AECoercion Interface
  1047. ;**************************************************************************
  1048. ;    Scripting components that support the AECoercion interface have the 
  1049. ;    kOSASupportsAECoercion bit set in it's ComponentDescription.
  1050. ;*************************************************************************
  1051. ;
  1052. ; pascal OSAError OSACoerceFromDesc(ComponentInstance scriptingComponent, const AEDesc *scriptData, long modeFlags, OSAID *resultingScriptID)
  1053. ;
  1054.     IF ¬ GENERATINGCFM THEN
  1055.         Macro
  1056.         _OSACoerceFromDesc
  1057.             dc.w     $2F3C
  1058.             dc.w     $000C
  1059.             dc.w     $0301
  1060.             moveq    #0,d0
  1061.             dc.w     $A82A
  1062.         EndM
  1063.     ELSE
  1064.         IMPORT_CFM_FUNCTION    OSACoerceFromDesc
  1065.     ENDIF
  1066.  
  1067. ;
  1068. ;        OSAComponentFunctionInline(kOSASelectCoerceFromDesc, 12);
  1069. ;        This routine causes script data to be coerced into a script value.
  1070. ;        If the scriptData is an AppleEvent, then the resultingScriptID is a
  1071. ;        compiled script ID (mode flags for OSACompile may be used in this case).
  1072. ;        Other scriptData descriptors create script value IDs.
  1073. ;    
  1074. ;        Errors:
  1075. ;            badComponentInstance    invalid scripting component instance
  1076. ;            errOSASystemError
  1077. ;    
  1078. ;        ModeFlags:
  1079. ;            kOSAModePreventGetSource
  1080. ;            kOSAModeCompileIntoContext
  1081. ;            kOSAModeNeverInteract
  1082. ;            kOSAModeCanInteract
  1083. ;            kOSAModeAlwaysInteract
  1084. ;            kOSAModeCantSwitchLayer
  1085. ;            kOSAModeDontReconnect
  1086. ;            kOSAModeDoRecord
  1087. ;    
  1088. ;
  1089. ; pascal OSAError OSACoerceToDesc(ComponentInstance scriptingComponent, OSAID scriptID, DescType desiredType, long modeFlags, AEDesc *result)
  1090. ;
  1091.     IF ¬ GENERATINGCFM THEN
  1092.         Macro
  1093.         _OSACoerceToDesc
  1094.             dc.w     $2F3C
  1095.             dc.w     $0010
  1096.             dc.w     $0302
  1097.             moveq    #0,d0
  1098.             dc.w     $A82A
  1099.         EndM
  1100.     ELSE
  1101.         IMPORT_CFM_FUNCTION    OSACoerceToDesc
  1102.     ENDIF
  1103.  
  1104. ;
  1105. ;        OSAComponentFunctionInline(kOSASelectCoerceToDesc, 16);
  1106. ;        This routine causes a script value to be coerced into any desired form.
  1107. ;        If the scriptID denotes a compiled script, then it may be coerced to 
  1108. ;        typeAppleEvent.
  1109. ;    
  1110. ;        Errors:
  1111. ;            badComponentInstance    invalid scripting component instance
  1112. ;            errOSASystemError
  1113. ;            errOSAInvalidID
  1114. ;    
  1115. ;*************************************************************************
  1116. ;    OSA Optional AESending Interface
  1117. ;**************************************************************************
  1118. ;    Scripting components that support the AESending interface have the 
  1119. ;    kOSASupportsAESending bit set in it's ComponentDescription.
  1120. ;*************************************************************************
  1121. ;
  1122. ;    Scripting systems will supply default values for these procedures if they
  1123. ;    are not set by the client:
  1124. ;
  1125. ;
  1126. ; pascal OSAError OSASetSendProc(ComponentInstance scriptingComponent, OSASendUPP sendProc, long refCon)
  1127. ;
  1128.     IF ¬ GENERATINGCFM THEN
  1129.         Macro
  1130.         _OSASetSendProc
  1131.             dc.w     $2F3C
  1132.             dc.w     $0008
  1133.             dc.w     $0401
  1134.             moveq    #0,d0
  1135.             dc.w     $A82A
  1136.         EndM
  1137.     ELSE
  1138.         IMPORT_CFM_FUNCTION    OSASetSendProc
  1139.     ENDIF
  1140.  
  1141. ;
  1142. ;        OSAComponentFunctionInline(kOSASelectSetSendProc, 8);
  1143. ;        If sendProc is nil, the default sendProc is used.
  1144. ;    
  1145. ;        Errors:
  1146. ;            badComponentInstance    invalid scripting component instance
  1147. ;            errOSASystemError
  1148. ;    
  1149. ;
  1150. ; pascal OSAError OSAGetSendProc(ComponentInstance scriptingComponent, OSASendUPP *sendProc, long *refCon)
  1151. ;
  1152.     IF ¬ GENERATINGCFM THEN
  1153.         Macro
  1154.         _OSAGetSendProc
  1155.             dc.w     $2F3C
  1156.             dc.w     $0008
  1157.             dc.w     $0402
  1158.             moveq    #0,d0
  1159.             dc.w     $A82A
  1160.         EndM
  1161.     ELSE
  1162.         IMPORT_CFM_FUNCTION    OSAGetSendProc
  1163.     ENDIF
  1164.  
  1165. ;
  1166. ;        OSAComponentFunctionInline(kOSASelectGetSendProc, 8);
  1167. ;    
  1168. ;        Errors:
  1169. ;            badComponentInstance    invalid scripting component instance
  1170. ;            errOSASystemError
  1171. ;    
  1172. ;
  1173. ; pascal OSAError OSASetCreateProc(ComponentInstance scriptingComponent, OSACreateAppleEventUPP createProc, long refCon)
  1174. ;
  1175.     IF ¬ GENERATINGCFM THEN
  1176.         Macro
  1177.         _OSASetCreateProc
  1178.             dc.w     $2F3C
  1179.             dc.w     $0008
  1180.             dc.w     $0403
  1181.             moveq    #0,d0
  1182.             dc.w     $A82A
  1183.         EndM
  1184.     ELSE
  1185.         IMPORT_CFM_FUNCTION    OSASetCreateProc
  1186.     ENDIF
  1187.  
  1188. ;
  1189. ;        OSAComponentFunctionInline(kOSASelectSetCreateProc, 8);
  1190. ;        If createProc is nil, the default createProc is used.
  1191. ;    
  1192. ;        Errors:
  1193. ;            badComponentInstance    invalid scripting component instance
  1194. ;            errOSASystemError
  1195. ;    
  1196. ;
  1197. ; pascal OSAError OSAGetCreateProc(ComponentInstance scriptingComponent, OSACreateAppleEventUPP *createProc, long *refCon)
  1198. ;
  1199.     IF ¬ GENERATINGCFM THEN
  1200.         Macro
  1201.         _OSAGetCreateProc
  1202.             dc.w     $2F3C
  1203.             dc.w     $0008
  1204.             dc.w     $0404
  1205.             moveq    #0,d0
  1206.             dc.w     $A82A
  1207.         EndM
  1208.     ELSE
  1209.         IMPORT_CFM_FUNCTION    OSAGetCreateProc
  1210.     ENDIF
  1211.  
  1212. ;
  1213. ;        OSAComponentFunctionInline(kOSASelectGetCreateProc, 8);
  1214. ;    
  1215. ;        Errors:
  1216. ;            badComponentInstance    invalid scripting component instance
  1217. ;            errOSASystemError
  1218. ;    
  1219. ;
  1220. ; pascal OSAError OSASetDefaultTarget(ComponentInstance scriptingComponent, const AEAddressDesc *target)
  1221. ;
  1222.     IF ¬ GENERATINGCFM THEN
  1223.         Macro
  1224.         _OSASetDefaultTarget
  1225.             dc.w     $2F3C
  1226.             dc.w     $0004
  1227.             dc.w     $0405
  1228.             moveq    #0,d0
  1229.             dc.w     $A82A
  1230.         EndM
  1231.     ELSE
  1232.         IMPORT_CFM_FUNCTION    OSASetDefaultTarget
  1233.     ENDIF
  1234.  
  1235. ;
  1236. ;        OSAComponentFunctionInline(kOSASelectSetDefaultTarget, 4);
  1237. ;        This routine sets the default target application for AE sending.
  1238. ;        It also establishes the default target from which terminologies come.
  1239. ;        It is effectively like having an AppleScript "tell" statement around
  1240. ;        the entire program.  If this routine is not called, or if the target 
  1241. ;        is a null AEDesc, then the current application is the default target.
  1242. ;    
  1243. ;        Errors:
  1244. ;            badComponentInstance    invalid scripting component instance
  1245. ;            errOSASystemError
  1246. ;    
  1247. ;*************************************************************************
  1248. ;    OSA Optional Recording Interface
  1249. ;**************************************************************************
  1250. ;    Scripting components that support the Recording interface have the 
  1251. ;    kOSASupportsRecording bit set in it's ComponentDescription.
  1252. ;*************************************************************************
  1253. ;
  1254. ; pascal OSAError OSAStartRecording(ComponentInstance scriptingComponent, OSAID *compiledScriptToModifyID)
  1255. ;
  1256.     IF ¬ GENERATINGCFM THEN
  1257.         Macro
  1258.         _OSAStartRecording
  1259.             dc.w     $2F3C
  1260.             dc.w     $0004
  1261.             dc.w     $0501
  1262.             moveq    #0,d0
  1263.             dc.w     $A82A
  1264.         EndM
  1265.     ELSE
  1266.         IMPORT_CFM_FUNCTION    OSAStartRecording
  1267.     ENDIF
  1268.  
  1269. ;
  1270. ;        OSAComponentFunctionInline(kOSASelectStartRecording, 4);
  1271. ;        Starts recording.  If compiledScriptToModifyID is kOSANullScript, a
  1272. ;        new script ID is created and returned.  If the current application has
  1273. ;        a handler for the kOSARecordedText event, then kOSARecordedText events
  1274. ;        are sent to the application containing the text of each AppleEvent 
  1275. ;        recorded.
  1276. ;    
  1277. ;        Errors:
  1278. ;            badComponentInstance    invalid scripting component instance
  1279. ;            errOSASystemError
  1280. ;            errOSAInvalidID
  1281. ;            errOSARecordingIsAlreadyOn
  1282. ;    
  1283. ;
  1284. ; pascal OSAError OSAStopRecording(ComponentInstance scriptingComponent, OSAID compiledScriptID)
  1285. ;
  1286.     IF ¬ GENERATINGCFM THEN
  1287.         Macro
  1288.         _OSAStopRecording
  1289.             dc.w     $2F3C
  1290.             dc.w     $0004
  1291.             dc.w     $0502
  1292.             moveq    #0,d0
  1293.             dc.w     $A82A
  1294.         EndM
  1295.     ELSE
  1296.         IMPORT_CFM_FUNCTION    OSAStopRecording
  1297.     ENDIF
  1298.  
  1299. ;
  1300. ;        OSAComponentFunctionInline(kOSASelectStopRecording, 4);
  1301. ;        If compiledScriptID is not being recorded into or recording is not
  1302. ;        currently on, no error is returned.
  1303. ;    
  1304. ;        Errors:
  1305. ;            badComponentInstance    invalid scripting component instance
  1306. ;            errOSASystemError
  1307. ;            errOSAInvalidID
  1308. ;    
  1309. ;*************************************************************************
  1310. ;    OSA Optional Convenience Interface
  1311. ;**************************************************************************
  1312. ;    Scripting components that support the Convenience interface have the 
  1313. ;    kOSASupportsConvenience bit set in it's ComponentDescription.
  1314. ;*************************************************************************
  1315. ;
  1316. ; pascal OSAError OSALoadExecute(ComponentInstance scriptingComponent, const AEDesc *scriptData, OSAID contextID, long modeFlags, OSAID *resultingScriptValueID)
  1317. ;
  1318.     IF ¬ GENERATINGCFM THEN
  1319.         Macro
  1320.         _OSALoadExecute
  1321.             dc.w     $2F3C
  1322.             dc.w     $0010
  1323.             dc.w     $0601
  1324.             moveq    #0,d0
  1325.             dc.w     $A82A
  1326.         EndM
  1327.     ELSE
  1328.         IMPORT_CFM_FUNCTION    OSALoadExecute
  1329.     ENDIF
  1330.  
  1331. ;
  1332. ;        OSAComponentFunctionInline(kOSASelectLoadExecute, 16);
  1333. ;        This routine is effectively equivalent to calling OSALoad followed by
  1334. ;        OSAExecute.  After execution, the compiled source is disposed.  Only the
  1335. ;        resulting value ID is retained.
  1336. ;    
  1337. ;        Errors:
  1338. ;            badComponentInstance        invalid scripting component instance
  1339. ;            errOSASystemError
  1340. ;            errOSABadStorageType:        scriptData not for this scripting component
  1341. ;            errOSACorruptData:            data seems to be corrupt
  1342. ;            errOSADataFormatObsolete    script data format is no longer supported
  1343. ;            errOSADataFormatTooNew        script data format is from a newer version
  1344. ;            errOSAInvalidID
  1345. ;            errOSAScriptError:            the executing script got an error
  1346. ;    
  1347. ;        ModeFlags:
  1348. ;            kOSAModeNeverInteract
  1349. ;            kOSAModeCanInteract
  1350. ;            kOSAModeAlwaysInteract
  1351. ;            kOSAModeCantSwitchLayer
  1352. ;            kOSAModeDontReconnect
  1353. ;            kOSAModeDoRecord
  1354. ;    
  1355. ;
  1356. ; pascal OSAError OSACompileExecute(ComponentInstance scriptingComponent, const AEDesc *sourceData, OSAID contextID, long modeFlags, OSAID *resultingScriptValueID)
  1357. ;
  1358.     IF ¬ GENERATINGCFM THEN
  1359.         Macro
  1360.         _OSACompileExecute
  1361.             dc.w     $2F3C
  1362.             dc.w     $0010
  1363.             dc.w     $0602
  1364.             moveq    #0,d0
  1365.             dc.w     $A82A
  1366.         EndM
  1367.     ELSE
  1368.         IMPORT_CFM_FUNCTION    OSACompileExecute
  1369.     ENDIF
  1370.  
  1371. ;
  1372. ;        OSAComponentFunctionInline(kOSASelectCompileExecute, 16);
  1373. ;        This routine is effectively equivalent to calling OSACompile followed by
  1374. ;        OSAExecute.  After execution, the compiled source is disposed.  Only the
  1375. ;        resulting value ID is retained.
  1376. ;    
  1377. ;        Errors:
  1378. ;            badComponentInstance    invalid scripting component instance
  1379. ;            errOSASystemError
  1380. ;            errAECoercionFail:        sourceData is not compilable
  1381. ;            errOSAScriptError:        sourceData was a bad script (syntax error)
  1382. ;            errOSAInvalidID:        previousAndResultingCompiledScriptID was not
  1383. ;                                    valid on input
  1384. ;            errOSAScriptError:        the executing script got an error
  1385. ;    
  1386. ;        ModeFlags:
  1387. ;            kOSAModeNeverInteract
  1388. ;            kOSAModeCanInteract
  1389. ;            kOSAModeAlwaysInteract
  1390. ;            kOSAModeCantSwitchLayer
  1391. ;            kOSAModeDontReconnect
  1392. ;            kOSAModeDoRecord
  1393. ;    
  1394. ;
  1395. ; pascal OSAError OSADoScript(ComponentInstance scriptingComponent, const AEDesc *sourceData, OSAID contextID, DescType desiredType, long modeFlags, AEDesc *resultingText)
  1396. ;
  1397.     IF ¬ GENERATINGCFM THEN
  1398.         Macro
  1399.         _OSADoScript
  1400.             dc.w     $2F3C
  1401.             dc.w     $0014
  1402.             dc.w     $0603
  1403.             moveq    #0,d0
  1404.             dc.w     $A82A
  1405.         EndM
  1406.     ELSE
  1407.         IMPORT_CFM_FUNCTION    OSADoScript
  1408.     ENDIF
  1409.  
  1410. ;
  1411. ;        OSAComponentFunctionInline(kOSASelectDoScript, 20);
  1412. ;        This routine is effectively equivalent to calling OSACompile followed by
  1413. ;        OSAExecute and then OSADisplay.  After execution, the compiled source
  1414. ;        and the resulting value are is disposed.  Only the resultingText
  1415. ;        descriptor is retained.  If a script error occur during processing, the 
  1416. ;        resultingText gets the error message of the error, and errOSAScriptError
  1417. ;        is returned.  OSAScriptError may still be used to extract more 
  1418. ;        information about the particular error.
  1419. ;    
  1420. ;        Errors:
  1421. ;            badComponentInstance    invalid scripting component instance
  1422. ;            errOSASystemError
  1423. ;            errAECoercionFail:        sourceData is not compilable or 
  1424. ;                                    desiredType not supported by scripting component
  1425. ;            errOSAScriptError:        sourceData was a bad script (syntax error)
  1426. ;            errOSAInvalidID:        previousAndResultingCompiledScriptID was not
  1427. ;                                    valid on input
  1428. ;            errOSAScriptError:        the executing script got an error
  1429. ;    
  1430. ;        ModeFlags:
  1431. ;            kOSAModeNeverInteract
  1432. ;            kOSAModeCanInteract
  1433. ;            kOSAModeAlwaysInteract
  1434. ;            kOSAModeCantSwitchLayer
  1435. ;            kOSAModeDontReconnect
  1436. ;            kOSAModeDoRecord
  1437. ;            kOSAModeDisplayForHumans
  1438. ;    
  1439. ;*************************************************************************
  1440. ;    OSA Optional Dialects Interface
  1441. ;**************************************************************************
  1442. ;    Scripting components that support the Dialects interface have the 
  1443. ;    kOSASupportsDialects bit set in it's ComponentDescription.
  1444. ;*************************************************************************
  1445. ;
  1446. ;    These calls allows an scripting component that supports different dialects
  1447. ;    to dynamically switch between those dialects.  Although this interface is
  1448. ;    specified, the particular dialect codes are scripting component dependent.
  1449. ;
  1450. ;
  1451. ; pascal OSAError OSASetCurrentDialect(ComponentInstance scriptingComponent, short dialectCode)
  1452. ;
  1453.     IF ¬ GENERATINGCFM THEN
  1454.         Macro
  1455.         _OSASetCurrentDialect
  1456.             dc.w     $2F3C
  1457.             dc.w     $0002
  1458.             dc.w     $0701
  1459.             moveq    #0,d0
  1460.             dc.w     $A82A
  1461.         EndM
  1462.     ELSE
  1463.         IMPORT_CFM_FUNCTION    OSASetCurrentDialect
  1464.     ENDIF
  1465.  
  1466. ;
  1467. ;        OSAComponentFunctionInline(kOSASelectSetCurrentDialect, 2);
  1468. ;    
  1469. ;        Errors:
  1470. ;            badComponentInstance    invalid scripting component instance
  1471. ;            errOSASystemError
  1472. ;            errOSANoSuchDialect:    invalid dialectCode
  1473. ;    
  1474. ;
  1475. ; pascal OSAError OSAGetCurrentDialect(ComponentInstance scriptingComponent, short *resultingDialectCode)
  1476. ;
  1477.     IF ¬ GENERATINGCFM THEN
  1478.         Macro
  1479.         _OSAGetCurrentDialect
  1480.             dc.w     $2F3C
  1481.             dc.w     $0004
  1482.             dc.w     $0702
  1483.             moveq    #0,d0
  1484.             dc.w     $A82A
  1485.         EndM
  1486.     ELSE
  1487.         IMPORT_CFM_FUNCTION    OSAGetCurrentDialect
  1488.     ENDIF
  1489.  
  1490. ;
  1491. ;        OSAComponentFunctionInline(kOSASelectGetCurrentDialect, 4);
  1492. ;    
  1493. ;        Errors:
  1494. ;            badComponentInstance    invalid scripting component instance
  1495. ;            errOSASystemError
  1496. ;    
  1497. ;
  1498. ; pascal OSAError OSAAvailableDialects(ComponentInstance scriptingComponent, AEDesc *resultingDialectInfoList)
  1499. ;
  1500.     IF ¬ GENERATINGCFM THEN
  1501.         Macro
  1502.         _OSAAvailableDialects
  1503.             dc.w     $2F3C
  1504.             dc.w     $0004
  1505.             dc.w     $0703
  1506.             moveq    #0,d0
  1507.             dc.w     $A82A
  1508.         EndM
  1509.     ELSE
  1510.         IMPORT_CFM_FUNCTION    OSAAvailableDialects
  1511.     ENDIF
  1512.  
  1513. ;
  1514. ;        OSAComponentFunctionInline(kOSASelectAvailableDialects, 4);
  1515. ;        This call return an AEList containing information about each of the
  1516. ;        currently available dialects of a scripting component.  Each item
  1517. ;        is an AERecord of typeOSADialectInfo that contains at least the fields
  1518. ;        keyOSADialectName, keyOSADialectCode, KeyOSADialectLangCode and 
  1519. ;        keyOSADialectScriptCode.
  1520. ;    
  1521. ;        Errors:
  1522. ;            badComponentInstance    invalid scripting component instance
  1523. ;            errOSASystemError
  1524. ;    
  1525. ;
  1526. ; pascal OSAError OSAGetDialectInfo(ComponentInstance scriptingComponent, short dialectCode, OSType selector, AEDesc *resultingDialectInfo)
  1527. ;
  1528.     IF ¬ GENERATINGCFM THEN
  1529.         Macro
  1530.         _OSAGetDialectInfo
  1531.             dc.w     $2F3C
  1532.             dc.w     $000A
  1533.             dc.w     $0704
  1534.             moveq    #0,d0
  1535.             dc.w     $A82A
  1536.         EndM
  1537.     ELSE
  1538.         IMPORT_CFM_FUNCTION    OSAGetDialectInfo
  1539.     ENDIF
  1540.  
  1541. ;
  1542. ;        OSAComponentFunctionInline(kOSASelectGetDialectInfo, 10);
  1543. ;        This call gives information about the specified dialect of a scripting
  1544. ;        component. It returns an AEDesc whose type depends on the selector 
  1545. ;        specified. Available selectors are the same as the field keys for a
  1546. ;        dialect info record. The type of AEDesc returned is the same as the 
  1547. ;        type of the field that has same key as the selector.
  1548. ;    
  1549. ;        Errors:
  1550. ;            badComponentInstance    invalid scripting component instance
  1551. ;            errOSASystemError
  1552. ;             errOSABadSelector
  1553. ;            errOSANoSuchDialect:    invalid dialectCode
  1554. ;    
  1555. ;
  1556. ; pascal OSAError OSAAvailableDialectCodeList(ComponentInstance scriptingComponent, AEDesc *resultingDialectCodeList)
  1557. ;
  1558.     IF ¬ GENERATINGCFM THEN
  1559.         Macro
  1560.         _OSAAvailableDialectCodeList
  1561.             dc.w     $2F3C
  1562.             dc.w     $0004
  1563.             dc.w     $0705
  1564.             moveq    #0,d0
  1565.             dc.w     $A82A
  1566.         EndM
  1567.     ELSE
  1568.         IMPORT_CFM_FUNCTION    OSAAvailableDialectCodeList
  1569.     ENDIF
  1570.  
  1571. ;
  1572. ;        OSAComponentFunctionInline(kOSASelectAvailableDialectCodeList, 4);
  1573. ;        This is alternative to OSAGetAvailableDialectCodeList. Use this call
  1574. ;        and  OSAGetDialectInfo to get information on dialects.
  1575. ;        This call return an AEList containing dialect code for each of the
  1576. ;        currently available dialects of a scripting component. Each dialect
  1577. ;        code is a short integer of type typeShortInteger.
  1578. ;    
  1579. ;        Errors:
  1580. ;            badComponentInstance    invalid scripting component instance
  1581. ;            errOSASystemError
  1582. ;
  1583. ;        Type of a dialect info record containing at least keyOSADialectName
  1584. ;        and keyOSADialectCode fields.
  1585. ;
  1586. ;        keys for dialect info record, also used as selectors to OSAGetDialectInfo.
  1587. ;
  1588. ;        Field of a typeOSADialectInfo record of typeChar.
  1589. ;        Field of a typeOSADialectInfo record of typeShortInteger.
  1590. ;        Field of a typeOSADialectInfo record of typeShortInteger.
  1591. ;        Field of a typeOSADialectInfo record of typeShortInteger.
  1592. ;    
  1593. ;*************************************************************************
  1594. ;    OSA Optional Event Handling Interface
  1595. ;**************************************************************************
  1596. ;    Scripting components that support the Event Handling interface have the 
  1597. ;    kOSASupportsEventHandling bit set in it's ComponentDescription.
  1598. ;*************************************************************************
  1599. ;
  1600. ; pascal OSAError OSASetResumeDispatchProc(ComponentInstance scriptingComponent, AEEventHandlerUPP resumeDispatchProc, long refCon)
  1601. ;
  1602.     IF ¬ GENERATINGCFM THEN
  1603.         Macro
  1604.         _OSASetResumeDispatchProc
  1605.             dc.w     $2F3C
  1606.             dc.w     $0008
  1607.             dc.w     $0801
  1608.             moveq    #0,d0
  1609.             dc.w     $A82A
  1610.         EndM
  1611.     ELSE
  1612.         IMPORT_CFM_FUNCTION    OSASetResumeDispatchProc
  1613.     ENDIF
  1614.  
  1615. ;
  1616. ;        OSAComponentFunctionInline(kOSASelectSetResumeDispatchProc, 8);
  1617. ;        This function is used to set the ResumeDispatchProc that will be used
  1618. ;        by OSAExecuteEvent and OSADoEvent if either no event handler can be
  1619. ;        found in the context, or the context event hander "continues" control
  1620. ;        onward. The two constants kOSAUseStandardDispatch and kOSANoDispatch
  1621. ;        may also be passed to this routine indicating that the handler registered
  1622. ;        in the application with AEInstallEventHandler should be used, or no
  1623. ;        dispatch should occur, respectively.
  1624. ;    
  1625. ;        Errors:
  1626. ;            badComponentInstance    invalid scripting component instance
  1627. ;            errOSASystemError
  1628. ;    
  1629. kOSAUseStandardDispatch            EQU        kAEUseStandardDispatch
  1630.  
  1631. ;
  1632. ;        Special ResumeDispatchProc constant which may be passed to 
  1633. ;        OSASetResumeDispatchProc indicating that the handler registered
  1634. ;        in the application with AEInstallEventHandler should be used.
  1635. ;        
  1636. ;        NOTE:    Had to remove the cast (AEEventHandlerUPP).  The C compiler
  1637. ;                doesn't allow pointer types to be assigned to an enum.  All
  1638. ;                constants must be assigned as enums to translate properly to
  1639. ;                Pascal.
  1640. ;    
  1641. kOSANoDispatch                    EQU        kAENoDispatch
  1642.  
  1643. ;
  1644. ;        Special ResumeDispatchProc constant which may be passed to 
  1645. ;        OSASetResumeDispatchProc indicating that no dispatch should occur.
  1646. ;        
  1647. ;        NOTE:    Had to remove the cast (AEEventHandlerUPP).  The C compiler
  1648. ;                doesn't allow pointer types to be assigned to an enum.  All
  1649. ;                constants must be assigned as enums to translate properly to
  1650. ;                Pascal.
  1651. ;    
  1652. kOSADontUsePhac                    EQU        $0001
  1653.  
  1654. ;
  1655. ;        Special refCon constant that may be given to OSASetResumeDispatchProc
  1656. ;        only when kOSAUseStandardDispatch is used as the ResumeDispatchProc.
  1657. ;        This causes the standard dispatch to be performed, except the phac
  1658. ;        handler is not called.  This is useful during tinkerability, when
  1659. ;        the phac handler is used to lookup a context associated with an event's 
  1660. ;        direct parameter, and call OSAExecuteEvent or OSADoEvent.  Failure to
  1661. ;        bypass the phac handler would result in an infinite loop.
  1662. ;    
  1663. ;
  1664. ; pascal OSAError OSAGetResumeDispatchProc(ComponentInstance scriptingComponent, AEEventHandlerUPP *resumeDispatchProc, long *refCon)
  1665. ;
  1666.     IF ¬ GENERATINGCFM THEN
  1667.         Macro
  1668.         _OSAGetResumeDispatchProc
  1669.             dc.w     $2F3C
  1670.             dc.w     $0008
  1671.             dc.w     $0802
  1672.             moveq    #0,d0
  1673.             dc.w     $A82A
  1674.         EndM
  1675.     ELSE
  1676.         IMPORT_CFM_FUNCTION    OSAGetResumeDispatchProc
  1677.     ENDIF
  1678.  
  1679. ;
  1680. ;        OSAComponentFunctionInline(kOSASelectGetResumeDispatchProc, 8);
  1681. ;        Returns the registered ResumeDispatchProc.  If no ResumeDispatchProc has
  1682. ;        been registered, then kOSAUseStandardDispatch (the default) is returned.
  1683. ;    
  1684. ;        Errors:
  1685. ;            badComponentInstance    invalid scripting component instance
  1686. ;            errOSASystemError
  1687. ;    
  1688. ;
  1689. ; pascal OSAError OSAExecuteEvent(ComponentInstance scriptingComponent, const AppleEvent *theAppleEvent, OSAID contextID, long modeFlags, OSAID *resultingScriptValueID)
  1690. ;
  1691.     IF ¬ GENERATINGCFM THEN
  1692.         Macro
  1693.         _OSAExecuteEvent
  1694.             dc.w     $2F3C
  1695.             dc.w     $0010
  1696.             dc.w     $0803
  1697.             moveq    #0,d0
  1698.             dc.w     $A82A
  1699.         EndM
  1700.     ELSE
  1701.         IMPORT_CFM_FUNCTION    OSAExecuteEvent
  1702.     ENDIF
  1703.  
  1704. ;
  1705. ;        OSAComponentFunctionInline(kOSASelectExecuteEvent, 16);
  1706. ;        This call is similar to OSAExecute except the initial command to
  1707. ;        execute comes in the form of an AppleEvent.  If the contextID
  1708. ;        defines any event handlers for that event, they are used to process
  1709. ;        the event.  If no event handler can be found in the context
  1710. ;        errAEEventNotHandled is returned.  If an event handler is found and
  1711. ;        the hander "continues" control onward, the ResumeDispatchProc
  1712. ;        (registered with OSASetResumeDispatchProc, above) is called given the
  1713. ;        AppleEvent.  The result is returned as a scriptValueID.
  1714. ;    
  1715. ;        Errors:
  1716. ;            badComponentInstance    invalid scripting component instance
  1717. ;            errOSASystemError
  1718. ;            errOSAInvalidID
  1719. ;            errOSAScriptError:        the executing script got an error
  1720. ;            errAEEventNotHandled:    no handler for event in contextID
  1721. ;    
  1722. ;        ModeFlags:
  1723. ;            kOSAModeNeverInteract
  1724. ;            kOSAModeCanInteract
  1725. ;            kOSAModeAlwaysInteract
  1726. ;            kOSAModeCantSwitchLayer
  1727. ;            kOSAModeDontReconnect
  1728. ;            kOSAModeDoRecord
  1729. ;    
  1730. ;
  1731. ; pascal OSAError OSADoEvent(ComponentInstance scriptingComponent, const AppleEvent *theAppleEvent, OSAID contextID, long modeFlags, AppleEvent *reply)
  1732. ;
  1733.     IF ¬ GENERATINGCFM THEN
  1734.         Macro
  1735.         _OSADoEvent
  1736.             dc.w     $2F3C
  1737.             dc.w     $0010
  1738.             dc.w     $0804
  1739.             moveq    #0,d0
  1740.             dc.w     $A82A
  1741.         EndM
  1742.     ELSE
  1743.         IMPORT_CFM_FUNCTION    OSADoEvent
  1744.     ENDIF
  1745.  
  1746. ;
  1747. ;        OSAComponentFunctionInline(kOSASelectDoEvent, 16);
  1748. ;        This call is similar to OSADoScript except the initial command to
  1749. ;        execute comes in the form of an AppleEvent, and the result is an 
  1750. ;        AppleEvent reply record.  If the contextID defines any event handlers
  1751. ;        for that event, they are used to process the event.  If no event handler
  1752. ;        can be found in the context errAEEventNotHandled is returned.  If an
  1753. ;        event handler is found and the hander "continues" control onward, the
  1754. ;        ResumeDispatchProc (registered with OSASetResumeDispatchProc, above) is
  1755. ;        called given the AppleEvent.  The result is returned in the form of an
  1756. ;        AppleEvent reply descriptor. If at any time the script gets an error, or
  1757. ;        if the ResumeDispatchProc returns a reply event indicating an error,
  1758. ;        then the OSADoEvent call itself returns an error reply (i.e. OSADoEvent
  1759. ;        should never return errOSAScriptError).  Any error result returned by
  1760. ;        the ResumeDispatchProc will be returned by OSADoEvent.
  1761. ;    
  1762. ;        Errors:
  1763. ;            badComponentInstance    invalid scripting component instance
  1764. ;            errOSASystemError
  1765. ;            errOSAInvalidID
  1766. ;            errAEEventNotHandled:    no handler for event in contextID
  1767. ;    
  1768. ;        ModeFlags:
  1769. ;            kOSAModeNeverInteract
  1770. ;            kOSAModeCanInteract
  1771. ;            kOSAModeAlwaysInteract
  1772. ;            kOSAModeCantSwitchLayer
  1773. ;            kOSAModeDontReconnect
  1774. ;            kOSAModeDoRecord
  1775. ;    
  1776. ;
  1777. ; pascal OSAError OSAMakeContext(ComponentInstance scriptingComponent, const AEDesc *contextName, OSAID parentContext, OSAID *resultingContextID)
  1778. ;
  1779.     IF ¬ GENERATINGCFM THEN
  1780.         Macro
  1781.         _OSAMakeContext
  1782.             dc.w     $2F3C
  1783.             dc.w     $000C
  1784.             dc.w     $0805
  1785.             moveq    #0,d0
  1786.             dc.w     $A82A
  1787.         EndM
  1788.     ELSE
  1789.         IMPORT_CFM_FUNCTION    OSAMakeContext
  1790.     ENDIF
  1791.  
  1792. ;
  1793. ;        OSAComponentFunctionInline(kOSASelectMakeContext, 12);
  1794. ;        Makes a new empty context which may be passed to OSAExecute or 
  1795. ;        OSAExecuteEvent.  If contextName is typeNull, an unnamed context is
  1796. ;        created. If parentContext is kOSANullScript then the resulting context
  1797. ;        does not inherit bindings from any other context.
  1798. ;    
  1799. ;        Errors:
  1800. ;            badComponentInstance    invalid scripting component instance
  1801. ;            errOSASystemError
  1802. ;            errOSAInvalidID
  1803. ;            errAECoercionFail:        contextName is invalid
  1804. ;    
  1805.     ENDIF ; __OSA__
  1806.